import 'package:get/get.dart';
import 'package:squat_easy/se_db/se_db_database.dart';
import 'package:squat_easy/se_db/se_db_entity.dart';
import 'package:squat_easy/se_service/se_user_service.dart';
import 'package:ylm_ui_kit/ylm_ui_kit.dart';

class SeHistoryLogic extends GetxController with CommonLife, OnceClick {
  List<Video> videos = [];

  @override
  void onReady() {
    super.onReady();
  }

  Future getVideos() async {
    final database = await $FloorSeAppDatabase.databaseBuilder(SeDbConstant.databaseName).build();
    final dao = database.videoDao;
    videos = await dao.findVideoByUserId(SeUserService.instance.userId);
    update();
  }

  @override
  void onClose() {
    super.onClose();
  }

  @override
  void pageBack() {
    super.pageBack();
    getVideos();
  }
}
